package com.yld.car.market;

import com.yld.car.market.tab.TabActivityGroup;

import cn.jpush.android.api.JPushInterface;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.ViewGroup.LayoutParams;
import android.widget.Button;
import android.widget.TextView;

public class MessagePushStateActivity extends BaseActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		// 自定义标题栏
		requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
		TextView tv = new TextView(this);
		tv.setText("用户自定义打开的Activity");
		Intent intent = getIntent();
		if (null != intent) {
			Bundle bundle = getIntent().getExtras();
			String title = bundle
					.getString(JPushInterface.EXTRA_NOTIFICATION_TITLE);
		String file=bundle.getString(JPushInterface.EXTRA_MSG_ID);
		System.out.println("msgId="+JPushInterface.EXTRA_MSG_ID);
		System.out.println("file==="+file);
		System.out.println("registerId==="+JPushInterface.getRegistrationID(this));
			String content = bundle.getString(JPushInterface.EXTRA_ALERT);
			tv.setText("Title : " + title + "  " + "Content : " + content);
		}
		addContentView(tv, new LayoutParams(LayoutParams.FILL_PARENT,
				LayoutParams.FILL_PARENT));

		// 设置布局
		getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.title);

		showBackButton();

		TextView titleText = ((TextView) findViewById(R.id.title));

		titleText.setText("车源消息中心");
		
	}

	@Override
	protected void showBackButton() {
		// TODO Auto-generated method stub
		// super.showBackButton();

		Button localButton = (Button) findViewById(R.id.leftButton);
		localButton.setVisibility(View.VISIBLE);
		localButton.setOnClickListener(new View.OnClickListener() {
			public void onClick(View paramView) {
				Intent intent = new Intent();
				intent.setClass(MessagePushStateActivity.this,
						TabActivityGroup.class);
				startActivity(intent);
				finish();
			}
		});

	}
}
